package com.gujia.concurrency.example.singleton;

import com.gujia.concurrency.annoations.NoThreadSafe;

/**
 * 懒汉模式
 * 单例实例再第一次使用时进行创建
 */
@NoThreadSafe
public class SingletonExample1 {


    private SingletonExample1(){

    }

    private static  SingletonExample1 instance = null;

    public static  SingletonExample1 getInnstance(){
        if(instance == null){
            instance = new SingletonExample1();
        }

        return instance;
    }


}
